home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
Digsby build 37
/
digsby_setup.exe
/
lib
/
dns
/
flags.pyo
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2008-10-13
|
2KB
|
68 lines
# Source Generated with Decompyle++
# File: in.pyo (Python 2.5)
QR = 32768
AA = 1024
TC = 512
RD = 256
RA = 128
AD = 32
CD = 16
DO = 32768
_by_text = {
'QR': QR,
'AA': AA,
'TC': TC,
'RD': RD,
'RA': RA,
'AD': AD,
'CD': CD }
_edns_by_text = {
'DO': DO }
_by_value = []([ (y, x) for x, y in _by_text.iteritems() ])
_edns_by_value = []([ (y, x) for x, y in _edns_by_text.iteritems() ])
def _order_flags(table):
order = list(table.iteritems())
order.sort()
order.reverse()
return order
_flags_order = _order_flags(_by_value)
_edns_flags_order = _order_flags(_edns_by_value)
def _from_text(text, table):
flags = 0
tokens = text.split()
for t in tokens:
flags = flags | table[t.upper()]
return flags
def _to_text(flags, table, order):
text_flags = []
for k, v in order:
if flags & k != 0:
text_flags.append(v)
continue
return ' '.join(text_flags)
def from_text(text):
return _from_text(text, _by_text)
def to_text(flags):
return _to_text(flags, _by_value, _flags_order)
def edns_from_text(text):
return _from_text(text, _edns_by_text)
def edns_to_text(flags):
return _to_text(flags, _edns_by_value, _edns_flags_order)